
#ifndef UART_SR_H
#define UART_SR_H


#include "Global.h"
#include "Typedefine.h"


typedef struct
{
	uchar u8_RefCurDispTemp;
	uchar u8_FrzCurDispTemp;
	uchar u8_RefCurSet;
	uchar u8_FrzCurSet;
	uchar u8_VarCurSet;
	uchar u8_refVarCurSet;
	uchar flagCurState1;
	uchar flagCurState2;
	uchar u8_VarCurDispTemp;           
}STATUS_DATA;

typedef struct
{
	uint u16_RefTemp;
	uint u16_FrzTemp;
	uint u16_FrzDefTemp;
	uint u16_RoomTemp;
	uint u16_RefVarTemp;
	uint u16_VarTemp;
	uchar u8_RefSpeed;
	uchar u8_FrzSpeed;
	uchar u8_CoolSpeed;
	uchar u8_CompFreq;
	uchar u8_WindDoorData;
	uchar u8_reserve1;
	uint u16_HeaterData;
	uint  u16_LedData;
    
}SPECIAL_STATUS_DATA;

extern uchar u8_Millisec;
extern uchar u8_HalfSec;
extern uchar u8_RefTemp;
extern uchar u8_FrzTemp;
extern uchar u8_FrzDefTemp;
extern uchar u8_VarTemp;
extern uchar u8_PwmValue;
extern uchar u8_FrzFanSpeed;
extern uchar u8_CoolFanSpeed;
extern uchar u8_RefFanSpeed;

extern BitType flagNet;
#define f_NetWorkSet    				flagNet.Bits.BIT0
#define f_NetWorkAck    				flagNet.Bits.BIT1
#define f_WifiSetting   				flagNet.Bits.BIT2
#define f_ForceDel      				flagNet.Bits.BIT3
#define f_ForceDelBak   				flagNet.Bits.BIT4
#define f_RefDoorCurBak  	 		flagNet.Bits.BIT5             
#define f_FrzLDoorCurBak   			flagNet.Bits.BIT6
#define f_FrzRDoorCurBak   			flagNet.Bits.BIT7

extern BitType flagNet1;
#define f_NetCodeLose   				flagNet1.Bits.BIT0
#define f_GetCode       				flagNet1.Bits.BIT1
#define f_CommonReport  			flagNet1.Bits.BIT2
#define f_SpecialReport 				flagNet1.Bits.BIT3
#define f_ForceDelFlash 				flagNet1.Bits.BIT4
#define f_MainRequiredState     		flagNet1.Bits.BIT5            

extern BitType flagNet2; 
#define f_WifiSignal          			flagNet2.Bits.BIT0
#define f_ConfigurationMode   		flagNet2.Bits.BIT1
#define f_ApErr               				flagNet2.Bits.BIT3
#define f_ServerErr           			flagNet2.Bits.BIT4
#define f_CommWifiBoardErr  		flagNet2.Bits.BIT6

extern BitType  flagSCI1;

#define f_Send1FF       				flagSCI1.Bits.BIT0
#define f_Send2FF       				flagSCI1.Bits.BIT1
#define f_SendDataSCI   				flagSCI1.Bits.BIT2
#define f_Send55        				flagSCI1.Bits.BIT3
#define f_Rec1FF        				flagSCI1.Bits.BIT4
#define f_Rec2FF        				flagSCI1.Bits.BIT5
#define f_RecDataSCI    				flagSCI1.Bits.BIT6
#define f_Rec55         				flagSCI1.Bits.BIT7

extern BitType  flagSCI2;
#define f_RecOverSCI    				flagSCI2.Bits.BIT0
#define f_NetStopAlarm  				flagSCI2.Bits.BIT1
#define f_NetAck        				flagSCI2.Bits.BIT2

#define CON_MaxSendByte 			84               
#define CON_MaxRecByte 			15

#define INVALID_VOID          		0x00
#define INVALID_FUZZY         		0x01
#define INVALID_HOLIDAY       	0x02
#define INVALID_SUPERFRZ      	0x03
#define INVALID_SUPERCOOL     	0x04
#define INVALID_SNRERR      		0x06
#define INVALID_LIMIT         		0x07
/***********************************************************************************************************************
Global Variables
***********************************************************************************************************************/

extern uchar u8_NetCommand;
extern uchar u8_NetPara[4];

extern uint  u16_NetReportTime100ms;
extern uint  u16_NetReportCommonTimer100ms;
extern uint  u16_NetReportSpecialTimer100ms;
extern uchar u16_GetCodeTimer2ms;
extern uchar u8_ForceDelTimer10s;
extern uchar u8_WifiSignalTimer10s;
extern uchar u8_WifiSettingTimer10s;
extern uchar u8_MainRequiredState10s;
extern uchar u8_RefSetTemp;
extern uchar u8_VarSetTemp;
extern uchar u8_FrzSetTemp;
extern uchar u8_BackLightTimer;
extern uchar u8_FrzQuitTimer;
extern uchar u8_VarQuitTimer;
extern uchar u8_RefQuitTimer;

void   Uart0Send(void);
void   Uart0Rec(void);
void QuitMainReceiveWifiErrorTimer(void);
void NetFunction(void);
void SCIRecOver(void);
void DealSend(void);
extern void QuitRefSetting(void);
extern void QuitFrzSetting(void);
extern void QuitVarSetting(void);


#endif
